package com.huanletao.proxy.cglib;

import java.lang.reflect.Method;

/**
 * <p>
 * </p>
 * package: com.huanletao.proxy.cglib
 * description:
 * className: JdkMethodInvocation
 * author:  踏雪无痕
 * copyright: Copyright (c) 2022/9/25 10:17
 * since: 1.0.0
 */
public class JdkMethodInvocation implements MethodInvocation {
    private final Object[] args;
    private final Object target;
    private final Method method;

    public JdkMethodInvocation(Object[] args, Object target, Method method) {
        this.args = args;
        this.target = target;
        this.method = method;
    }

    @Override
    public Object[] getArguments() {
        return args;
    }

    @Override
    public Object proceed() throws Throwable {
        return method.invoke(target, args);
    }
}
